package com.iotechn.unimall.app.api.goods;

import com.iotechn.unimall.data.dto.goods.ShopOneDTO;
import com.iotechn.unimall.data.mapper.ShopOneMapper;
import com.iotechn.unimall.data.model.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.rmi.ServerException;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: rize
 * Date: 2019/11/24
 * Time: 15:26
 */
@Service
public class ShopOneServiceImpl implements ShopOneService {

    @Autowired
    private ShopOneMapper shopOneMapper;

    @Override
    public Page<ShopOneDTO> getShopOnePage(String shopName, Long shopId,Integer type, Integer pageNo, Integer pageSize) throws ServerException {
        Integer count = shopOneMapper.selectCount(null);
        List<ShopOneDTO> groupShopPage = shopOneMapper.getShopOnePage(shopName,null, shopId, type,(pageNo - 1) * pageSize, pageSize);
        return new Page<>(groupShopPage, pageNo, pageSize, count);
    }


}
